summaryrefslogtreecommitdiff
path: root/app/[lng]/admin/layout.tsx
blob: 918a8554b5ff4baf982b60255e5cee6898c46ed0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { getServerSession } from "next-auth"
import { authOptions } from "@/app/api/auth/[...nextauth]/route"
import { redirect } from "next/navigation"

export default async function AdminLayout({
  children,
}: {
  children: React.ReactNode
}) {
  const session = await getServerSession(authOptions)
  
  // 세션이 없거나 domain이 'evcp'가 아닌 경우 접근 거부
  if (!session?.user || session.user.domain !== 'evcp') {
    redirect('/en/evcp')
  }

  return (
    <div className="min-h-screen bg-gray-50">
      <div className="bg-white shadow-sm border-b">
        <div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
          <div className="flex justify-between items-center py-4">
            <h1 className="text-2xl font-bold text-gray-900">임시 관리자 페이지</h1>
            <div className="text-sm text-gray-600">
              {session.user.name} ({session.user.email})
            </div>
          </div>
        </div>
      </div>
      <div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
        {children}
      </div>
    </div>
  )
}